import http from "./index.js"
/** 获取榜单 */
const reqToplist = async (data) => {
    return new Promise((resolve, reject) => {
        http.get("/wapi/toplist/detail", {}).then((res) => {
          resolve(res);
        });
      });
}
/** 获取榜单歌曲列表 */
const reqTopDetaliList = ({ id, limit, offset }) => {
  return new Promise((resolve, reject) => {
    http
      .get(`/wapi/playlist/track/all?id=${id}&limit=${limit}&offset=${offset}`, {})
      .then((res) => {
        resolve(res);
      });
  });
};
/** 获取歌曲详情 */
const reqMusicDetail = ({ id, level }) => {
  return new Promise((resolve, reject) => {
    http.get(`/wapi/song/url/v1?id=${id}&level=${level}`, {}).then((res) => {
      resolve(res);
    });
  });
};
// 根据歌曲id获取歌词
const reqMusicLyricById = (id) => {
  return new Promise((resolve, reject) => {
    http.get(`/wapi/lyric?id=${id}`, {}).then((res) => {
      resolve(res);
    });
  });
};
const reqSearch = (keyWords) => {
  return new Promise((resolve, reject) => {
    http.get(`/wapi/search/suggest?keywords=${keyWords}`, {}).then((res) => {
      resolve(res);
    });
  });
};
// 根据歌手搜索热门歌曲
const reqSearchSingerHot = ({ id, limit, offset }) => {
  return new Promise((resolve, reject) => {
    http
      .get(`/wapi/artist/top/song?id=${id}&offset=${offset}&limit=${limit}&order=hot`, {})
      .then((res) => {
        resolve(res);
      });
  });
};
export {
    reqToplist,
    reqTopDetaliList,
    reqMusicDetail,
    reqMusicLyricById,
    reqSearch,
    reqSearchSingerHot
}